#ifndef PAIR_H
#define PAIR_H

struct Pair
{
	Object *head;
	Object *tail;
};

extern Pair *Pair_new(Object *, Object *);
extern Object *OPair_new(Object *, Object *);
extern Object *Pair_eval(Object *);
extern const char *Pair_to_cstr(Object *);
extern Object *Pair_equal(Object *, Object *);
extern int pair_equal(Object *, Object *);
extern Object *Pair_head(Object *);
extern Object *Pair_tail(Object *);

#define Cons(x, y) Pair_new((x), (y))
#define Head(o) Pair_head(o)
#define Tail(o) Pair_tail(o)

/* Pair get & set convenience macros */
/* These are understood to ACT ONLY on _PAIR_ pointers, *NOT* on OBJECT pointers */
#define gethead(p) ((p)->head)
#define gettail(p) ((p)->tail)
#define sethead(p, x) (gethead(p) = (x))
#define settail(p, x) (gettail(p) = (x))

#endif /* !PAIR_H */
